<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="Header.jsp"%>
<%@ include file="Menu.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<fmt:setBundle basename="messages" />
<!--<c:set var="t" value="true" />-->
<title>Add New User </title>
</head>
<body>
<form action="AdminAddServlet" method="post">
<h3 align="center">Add New User</h3>
<table align="center">

<tr>
<td valign="middle">Name:</td> 
<td valign="middle"> <input type="text" value="${param['name']}" name="name"><br><br></td>
</tr>
<tr>
<td valign="middle">Role:</td> 
<td valign="middle"> <input type="text" value="${param['role']}" name="role"><br></td>
</tr>
<tr>
<td valign="middle">Rank:</td> 
<td valign="middle"> <input type="text" value="${param['Rank']}" name="Rank"><br></td>
</tr>
<tr>
<td valign="middle">Email:</td> 
<td valign="middle"> <input type="text" value="${param['email']}" name="email"><br></td>
</tr>
<tr>
<td valign="middle">Username:</td> 
<td valign="middle"> <input type="text" value="${param['uname']}" name="uname"><br></td>
</tr>
<tr>
<td valign="middle">Password:</td> 
<td valign="middle"> <input type="text" value="${param['pswd']}" name="pswd"><br><br><br></td>
</tr>

<tr >
<td align="center" colSpan="2"><input type="submit" value="Add" name="add">
</td>
<td align="center" colSpan="2"><input type="reset" value="Reset" name="reset">
</td>
</tr>

</table>

</form>

<%
	String result = (request.getAttribute("result") != null) ? request.getAttribute("result").toString() : "";
	if(!result.equals("")) {
%>
	<script>
	alert("<%=result%>");
	</script>
<%
	if(result.contains("Success")) {
		%>
		<script>
		
		document.getElementById("name").value = "";
		document.getElementById("empid").value = "";
		document.getElementById("role").value = "";
		document.getElementById("email").value = "";
		document.getElementById("uname").value = "";
		document.getElementById("pswd").value = "";
		document.getElementById("mgr").value = "";
		</script>
		<%		
	}
}%>

</body>
</html>